# -*- coding: UTF-8 -*-
bob = ['Bob Smith', 42, 30000, 'software']
sue = ['Sue Jones', 45, 40000, 'hardware']
people = [bob, sue]  # 引用列表的列表

for person in people:
    print(person[0].split()[-1])  # 打印姓氏
    person[2] *= 1.2  # 涨20%薪水
# 结果： Smith Jones

for person in people:
    print(person[2])  # 新的薪酬
# 结果：36000.0 48000.0

pays = [person[2] for person in people]  # 收集薪酬信息
print(pays)
# 结果：[36000.0, 48000.0]

pays = map((lambda x: x[2]), people)  # 同上
print(list(pays))
# 结果：[36000.0, 48000.0]

print(sum(person[2] for person in people))  # 生成器表达式, sum 为内建函数
# 结果：84000.0

people.append(['Tom', 50, 0, None])
print(len(people))
# 结果：3

print(people[-1][0])
# 结果：Tom